<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<meta name="format-detection" content="telephone=no">
	<title></title>
	<script type="text/javascript" src="../applyandactivate/js/stats.js" charset="UTF-8"></script>
	<link rel="stylesheet" href="../applyandactivate/css/frozen.css">
	<link rel="stylesheet" href="../applyandactivate/css/style.css">
	<script src="../applyandactivate/lib/zepto.min.js"></script>
	<script src="../applyandactivate/js/frozen.js"></script>
	<script src="../js/link.js"></script>
</head>

<body ontouchstart>
	<div style="width:100%;height:100px;">
		<h4 style="width:40px;margin:40px auto;">loading...</h4>
	</div>
</body>
<script type="text/javascript">
$(function() {
//获取url中的参数
	
	function getQueryString(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
		var r = window.location.search.substr(1).match(reg);
		if(r != null) {
			return unescape(r[2]);
		}
		return null;
	}
	var mobile = getQueryString("mobile");//手机号
	// mobile = "13000000000";
	var bankAct = getQueryString("bankAct");//开户号
	var insuraceNo = getQueryString("insuraceNo");//保单号
	//sessionStorage中缓存的数据
	var session = window.sessionStorage;
	session.setItem("bankAct",bankAct);//缓存理赔账号
	session.setItem("insuraceNo",insuraceNo);//缓存保单号
	var channelCode=session.getItem("channelCode");//渠道号
	var orderCode=session.getItem("orderCode");//订单号
	var businessCode=session.getItem("businessCode");//业务代码
	var baseAddress=session.getItem("baseAddress");//基地地址
	var sex = session.getItem("sex"); //性别
	var applyCase = session.getItem("applyCase"); //护照类型原因
	var applyType = session.getItem("applyType");//护照类型
	var name = session.getItem("name"); //用户名字
	var cardType = session.getItem("cardType"); //身份证
	var cardNO = session.getItem("cardNO"); //身份证号
	var birthday = session.getItem("birthday"); //出生日期
	var guardianName = session.getItem("guardianName");//监护人姓名
	var guardianRelation = session.getItem("guardianRelation");//监护人关系
	var guardianCardType = session.getItem("guardianCardType");//监护人证件类型
	var guardianCardNo = session.getItem("guardianCardNo");//监护人证件编号
	var guardianSex = session.getItem("guardianSex");//监护人性别
	var guardianMobile = session.getItem("guardianMobile");
	if (guardianMobile!="" && guardianMobile!=null && guardianMobile!="null") {
		mobile = guardianMobile;
	}
	// alert(mobile);
	var dataStr={
			channelCode:channelCode,
			orderCode:orderCode,
			businessCode:businessCode,
			bassAddressId:baseAddress,
			name:name,
			cardType:cardType,
			cardNO:cardNO,
			birthday:birthday,
			sex:sex,
			applyType:applyType,
			applyCase:applyCase,
			mobile:mobile,
			guardianPhone:mobile,
			guardianName:guardianName,
			guardianRelation:guardianRelation,
			guardianCardType:guardianCardType,
			guardianCardNo:guardianCardNo,
			guardianSex:guardianSex
		}

	$.ajax({
		url: rootPath+"/v1/passport/applyAndActivate",
		type: 'post',
		dataType: 'json',
		contentType: 'application/json; charset=utf-8',
		data: JSON.stringify(dataStr),
		error: function(datas){
			  
			}, //错误执行方法
		success: function(datas){
		if (datas["code"]==0) {
				var passportOrderCode = datas["data"]["orderNum"];
				window.sessionStorage.setItem("passportOrderCode",passportOrderCode);
            	window.location.href="success.html";
			}else{
				alert(datas["message"]+"!!");
			}
		}//成功执行方法
   })
	
})
</script>

</html>
